package com.example.collections;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

/**
 * @author csp 2020-12-17
 */
public class SetTest {
    @Test
    public void test_1(){
        HashSet<String> set1 = new HashSet<>();
        HashSet<String> set2 = new HashSet<>();
        for (int i = 0; i < 10; i++) {
            set1.add(UUID.randomUUID().toString());
        }
        for (int i = 0; i < 10; i++) {
            set2.add(UUID.randomUUID().toString());
        }
        Set<String> set = (Set<String>) set1.clone();
        set.addAll(set2);
        System.out.println(set.toString());
        if (set.size()<(set1.size()+set2.size())) {
            System.out.println("重复");
        }else if(set.size()==(set1.size()+set2.size())){
            System.out.println("不" +
                    "重复");
        }
    }

}
